import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-05-11
 * Time: 13:57
 */
//给定两个数，求这两个数的最大公约数
public class test {
    public static void main(String[] args){
        Scanner n=new Scanner(System.in);
        int a=n.nextInt();
        int b=n.nextInt();
        int c=0;
        if(a<b);
        {
            c=a;
            a=b;
            b=c;
        }
        while(a%b!=0)
        {
            c=a%b;
            a=b;
            b=c;
        }
        System.out.println("最大公约数为"+b);
    }
}
